package com.aurora.spider.gitee;

import com.geccocrawler.gecco.annotation.*;
import com.geccocrawler.gecco.spider.HtmlBean;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

/**
 * Created by jackie on 18/1/15.
 */
@Document(indexName = "gitee_spider")
@Gecco(matchUrl="https://gitee.com/{auther}/{projectName}?_from=gitee_search", pipelines={"consolePipeline","giteeProDetailPipeline"})
public class ProductDetail implements HtmlBean {

    private static final long serialVersionUID = -377053120283382723L;

    @Id
    private Integer id ;
    /**
     * 文本内容
     */
    @Field(type = FieldType.Text, analyzer = "ik_max_word")
    @HtmlField(cssPath="#git-readme > div > div.file_content.markdown-body")
    private String content;

    @RequestParameter
    private String auther;

    @Field(type = FieldType.Text, analyzer = "ik_max_word")
    @RequestParameter
    private String projectName;
    /**
     * 标题
     */
    @Field(type = FieldType.Text, analyzer = "ik_max_word")
    @Text
    @HtmlField(cssPath="body > div.site-content > div.git-project-header > div.ui.container > div > div > h2")
    private String title;

    @Attr("value")
    @HtmlField(cssPath="#project_clone_url")
    private String gitUrl;

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public String getAuther() {
        return auther;
    }

    public void setAuther(String auther) {
        this.auther = auther;
    }

    public String getProjectName() {
        return projectName;
    }

    public void setProjectName(String projectName) {
        this.projectName = projectName;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getGitUrl() {
        return gitUrl;
    }

    public void setGitUrl(String gitUrl) {
        this.gitUrl = gitUrl;
    }
}
